package com.cy.mall.service.store.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cy.mall.dao.mapper.store.StoreMapper;
import com.cy.mall.model.PageBean;
import com.cy.mall.model.domain.store.Store;
import com.cy.mall.model.query.store.StoreListQuery;
import com.cy.mall.model.vo.store.EnableStoreListVO;
import com.cy.mall.model.vo.store.StoreListVO;
import com.cy.mall.service.BaseService;
import com.cy.mall.service.store.StoreService;

/**
 * 门店StoreService
 *
 * @author tanyilin
 *
 * @create 2019年1月24日 下午3:20:52
 */
@Service
public class StoreServiceImpl extends BaseService implements StoreService {

	@Autowired
	private StoreMapper storeMapper;
	
	@Override
	public PageBean<StoreListVO> selectStoreList(StoreListQuery query) {
		int total = storeMapper.selectStoreListCount(query);
		List<StoreListVO> list = new ArrayList<>();
		if(total > 0) {
			query.startPage();
			list = storeMapper.selectStoreList(query);
		}
		return new PageBean<>(list, total);
	}

	@Override
	public List<EnableStoreListVO> allEnableStoreList(Long brandId) {
		List<EnableStoreListVO> list = storeMapper.selectAllEnableStoreList(brandId);
		return list;
	}

}
